/* 
           class类
   1 constructor
   2 属性
   3 方法
*/
class Student {
    constructor(name, age, gender) {
        this.name = name;
        this.age = age;
        this.gender = gender;
    }
    sayHi() {
        console.log(`我是学生，我叫${this.name}，今年${this.age}岁，性别${this.gender}`);

    }
    static skill() {
        console.log('我是一个学生，我擅长写作');

    }
}
let xialuo = new Student('夏洛克', 18, '男');
console.log(xialuo, 'xialuo');
xialuo.sayHi();
Student.skill();
let xiaowang = new Student('夏王', 17, '女');
console.log(xiaowang, 'xiaowang');
xiaowang.sayHi();
/* 
    继承
1。extends关键字
2。super关键字
3.扩展或重写方法
*/
class Teacher extends Student {
    constructor(name, age, gender, skill) {
        super(name, age, gender) //继承的属性
        this.skill = skill //新增的属性
    }
    sayHi() {
            console.log('我是老师，我叫' + this.name + '，今年' + this.age + '岁，性别' + this.gender);

        }
        /* 重写父类的方法 */
    static skill() {
        console.log('我是一个老师，我擅长教学');

    }

}
let t1 = new Teacher('老师1', 30, '男', '教数学');
console.log(t1, 't1');
console.log(t1.__proto__ ===Teacher.prototype); //true
console.log(t1.__proto__ ===Student.prototype,); //false
console.log(t1.__proto__.__proto__ ===Student.prototype,); //true
t1.sayHi();
Teacher.skill();